/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.DragonPokerServer;

import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.Comunicator.Global;
import org.DragonPokerServer.Thread.ThreadUser;
import org.DragonPokerServer.dbclasses.Room;
import org.DragonPokerServer.dbclasses.Table;
import org.DragonPokerServer.dbclasses.User;

/**
 *
 * @author Administrator
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
//        Session s = HibernateUtil.getSessionFactory().openSession();
//        Server se = new Server();
//        se.start();
        
//            TestDeck t = new TestDeck();
//            //t.EseguiTest();
//            t.testDistribuisci();
//            t.testFlop();
//            t.testTurnRiver();
//        TestRoom t = new TestRoom();
//        System.out.println("||||||||||||||||||||||||||||||||");
//        t.test();
//        t.ControllaScala();

        User u1 = new User();
        u1.setId(1);
        u1.setUsername("Skyline");
        ThreadUser tu = new ThreadUser(new Socket());
        tu.setUser(u1);
        Table t = new Table();
        t.setDimension(2);
        Room r1 = new Room();
        r1.setId(1);
        r1.setName("Abete");
        r1.setMaxPlayers(2);
        r1.setPlayersIn(1);
        r1.setState(Room.OPEN);
        r1.setType(Room.CASH);
        r1.getTables().add(t);
//        r1.getPlayers().add(tu);

        
        Room r2 = new Room();
        r2.setId(2);
        r2.setName("Pino");
        r2.setMaxPlayers(5);
        r2.setPlayersIn(5);
        r2.setState(Room.OPEN);
        r2.setType(Room.CASH);
        
        Global.rooms.add(r1);
        Global.rooms.add(r2);

        System.out.println("MAIN: Parte server");
        Server server = new Server();
        server.start();
        try {
            Thread.sleep(2000);
        } catch (InterruptedException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
            
    }

}
